Title
summary
alt.data_transformers.disable_max_rows()
# Define the 3 Charts
chart_1 = alt.Chart(data_indicators, width=300, height=300).mark_bar(opacity=.50).transform_filter(
alt.FieldOneOfPredicate(
field='indicators', oneOf=['s','beta'])).encode(
x='Name:N',
y=alt.Y('value:Q',stack=None),
color=alt.Color('indicators', scale=alt.Scale(domain=['beta','s'], range=['red','blue'])))
chart_2 = alt.Chart(data_markups, width=300, height=300).mark_point().encode(
x='markups:Q',
y='markups_supplier:Q',
tooltip=['Name', 'country', 'markups', 'markups_supplier'])
chart_3 = alt.Chart(data_flows,width = 600, height = 600).mark_rect().encode(
x='suppliers:N',
y='Name:N',
color = 'value:Q',
tooltip=['value'])
# Define the Country Dropdown
country_dropdown = alt.binding_select(options=data_renamed.country.unique())
country_select = alt.selection_single(fields=['country'], bind=country_dropdown, name='Select')
# Define interactive charts
filter_chart_1 = chart_1.add_selection(
country_select
).transform_filter(
country_select
).properties(title="Impact of each Sector by country")
filter_chart_2 = chart_2.add_selection(
country_select
).transform_filter(
country_select
).properties(title="Markups by country")
filter_chart_3 = chart_3.add_selection(
country_select
).transform_filter(
country_select
).properties(title="I/O parameters by country")
# Display charts
(filter_chart_1 | filter_chart_2) & (filter_chart_3)
data_flows
data_indicators